#!/bin/bash  
#安装依赖包
yum install -y yum-utils   device-mapper-persistent-data   lvm2
#设置Docker源
yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
#安装docker
yum install docker-ce-18.09.6 docker-ce-cli-18.09.6 containerd.io
#安装bash-completion
yum -y install bash-completion
source /etc/profile.d/bash_completion.sh
#配置镜像加速器
#配置daemon.json文件
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://mvzgr0xh.mirror.aliyuncs.com"]
}
EOF
启动：
systemctl daemon-reload && systemctl start docker && systemctl enable docker
#验证
docker --version